import {
  RouteObject,
  PathRouteProps,
  createBrowserRouter,
  Navigate,
} from "react-router-dom";
import loadable from "react-loadable";
import homeRoute from "./pages/home/router_config";

const Layout = loadable({
  loader: () => import("./layout"),
  loading: () => null,
});

const reactRouterList: RouteObject[] = [
  {
    path: "/",
    element: <Layout />,
    children: [
      {
        index: true,
        element: <Navigate to="/home" replace />,
      },
      ...homeRoute,
    ],
  },
];

export default createBrowserRouter(reactRouterList);
